package thread;

import javax.swing.plaf.TableHeaderUI;

/**
 * @Author liangzai
 * @Description:
 */
public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            while (!Thread.currentThread().isInterrupted()) {
//                try {
//                    System.out.println("hello thread!");
//                    Thread.sleep(1000);
//                } catch (InterruptedException e) {
//
//                }
                System.out.println("hello thread!");
            }
            System.out.println("t 被结束了！");
        });
        t.start();
        Thread.sleep(2000);
        System.out.println("main结束了 t!");
        t.interrupt();
    }
}
